' Deal with the Market Depth Updating.
Private Sub moMarket_MarketDepthUpdate(ByVal poMarket As Market) Handles moMarket.MarketDepthUpdate
' Invoke the update on the main UI thread if needed.
If Me.InvokeRequired Then
Me.BeginInvoke(New MethodInvoker(AddressOf MarketDepthUpdate))
Else
MarketDepthUpdate()
End If
End Sub
' Update the display.
Private Sub MarketDepthUpdate()
' Lock the market object so that we can safely process the depth.
Try
moMarket.EnterLock()
' Display the market depth.
Finally
' Make sure that we exit the lock regardless of anything else that happens.
moMarket.ExitLock()
End Try
End Sub